package com.deke.vo.config;

import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;

/**
 * @author ：Username 刘亦辰（59372312@qq.com）
 * @date ：Created in 2022/12/5 21:27
 * @description：
 * @modified By：
 * @version:
 **/
@Configuration
@EnableSwagger2
public class MySwaggerConfig {

    @Bean
    public Docket webApiConfig(){
        return new Docket(DocumentationType.SWAGGER_2)
                //组名
                .groupName("德可课堂")
                //aip信息
                .apiInfo(getInfo())
                //选择哪些生成aip接口--根据请求路径选择  2. 根据包名选择
                .select()
                //根据请求路径选择
                .paths(Predicates.not(PathSelectors.regex("/error/*")))
                //更具包名
                //.apis(RequestHandlerSelectors.basePackage("com."))
                .build();
    }


    private ApiInfo getInfo(){
        Contact contact = new Contact("刘亦辰", "http://www.jd.com", "59372312@qq.com");
        ApiInfo info = new ApiInfo("德可课堂API", "德可课堂API", "2.0", "http://www.baidu.com",
                ApiInfo.DEFAULT_CONTACT, "漫动者", "http://www.aaa.com", new ArrayList<VendorExtension>());
        return  info;
    }



}